import request from "@/utils/request";

class UserAPI {
  /**
   * 获取用户分页列表
   *
   * @param queryParams
   */
  static getPage(queryParams: any) {
    return request<any, PageResult<any[]>>({
      url: "/api/v1/coupons/page",
      method: "get",
      params: queryParams,
    });
  }

  /**
   * 添加用户
   *
   * @param data
   */
  static add(data: any) {
    return request({
      url: "/api/v1/coupons",
      method: "post",
      data: data,
    });
  }

  /**
   * 修改用户
   *
   * @param id
   * @param data
   */
  static update(id: number, data: any) {
    return request({
      url: "/api/v1/coupons/" + id,
      method: "put",
      data: data,
    });
  }


  /**
   * 删除用户
   *
   * @param ids
   */
  static deleteByIds(ids: string) {
    return request({
      url: "/api/v1/coupons/" + ids,
      method: "delete",
    });
  }

  /**
   * 导出用户
   *
   * @param queryParams
   * @returns
   */
  static export(queryParams: any) {
    return request({
      url: "/api/v1/coupons/export",
      method: "get",
      params: queryParams,
      responseType: "arraybuffer",
    });
  }
}

export default UserAPI;
